<?php


namespace app\service;


use app\dao\DepositStatusDao;

class DepositStatusService
{
    private $DepositStatusDao;

    public function __construct()
    {
        $this->DepositStatusDao = new DepositStatusDao();
    }

    public function getDepositStatus($id){
        return $this->DepositStatusDao->customQuery()->filterById($id)->getOne();
    }

    public function addDepositStatus($return_pay , $get_time , $status , $remarks){
        return $this->DepositStatusDao->save([
            'return_pay' => $return_pay,
            'get_time' => $get_time,
            'status' => $status,
            'remarks' => $remarks
        ]);
    }

    public function editDepositStatus($id , $data){
        $editData = [];
        empty($data['return_pey']) || $editData['return_pey'] = $data['return_pey'];
        empty($data['get_time']) || $editData['get_time'] = $data['get_time'];
        empty($data['status']) || $editData['status'] = $data['status'];
        empty($data['remarks']) || $editData['remarks'] = $data['remarks'];

        return $this->DepositStatusDao->edit($id , $data);
    }
}